#ifndef PRODUCTMANAGEMENTPANEL_H
#define PRODUCTMANAGEMENTPANEL_H

#include <QWidget>

class QTableWidget;
class QPushButton;
class QLabel;

// Forward declaration for C struct
struct DrinkNode;

class ProductManagementPanel : public QWidget
{
    Q_OBJECT
public:
    explicit ProductManagementPanel(QWidget *parent = nullptr);
    ~ProductManagementPanel(); // Add destructor to free memory

private slots:
    void loadProducts();
    void addProduct();
    void editProduct();
    void deleteProduct();

private:
    void setupUi();
    void populateTable();
    void clearTable();
    void freeProductList(); // Helper to free C linked list

    QTableWidget* productTable;
    QPushButton* btnAdd;
    QPushButton* btnEdit;
    QPushButton* btnDelete;
    QPushButton* btnRefresh;
    QLabel* lblProductCount;

    DrinkNode* productListHead = nullptr; // Head of the C linked list for drinks
};

#endif // PRODUCTMANAGEMENTPANEL_H